import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
    name: 'avNumberString'
})
export class AvNumberStringPipe implements PipeTransform {
    transform(input: any) {
        if (input === undefined || input === null || input === '' || isNaN(input)) {
            return input;
        }
        const parts = input.toString().split('.');
        parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
        return parts.join('.');
    }
}
